import { getDaysFun } from '@/utlis/date'
import * as echarts from 'echarts'
let days = 7; // 近7天
const weekData = getDaysFun(days).reverse()
const option = {
    // color: color,
    title: {
        text: '近七日走势',
        textStyle: {
            color: '#B4B4B4',
            fontSize: 16,
            fontWeight: 'normal',
        },
    },
    // backgroundColor: '#191E40',
    backgroundColor: '#f0f0f0',
    tooltip: {
        trigger: 'axis'
    },
    legend: {
        data: ['交易量', '交易额', '成交量', '成交额'],
        textStyle: {
            color: '#B4B4B4'
        },
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    toolbox: {
        feature: {
            saveAsImage: {}
        }
    },
    xAxis: {
        type: 'category',
        axisLine: {
            lineStyle: {
                color: '#B4B4B4'
            }
        },
        boundaryGap: false,
        data: weekData
    },
    yAxis: [{

        splitLine: { show: true },
        axisLine: {
            lineStyle: {
                color: '#B4B4B4',
            }
        },

        axisLabel: {
            formatter: '{value} ',
        }
    },
    {

        splitLine: { show: true },
        axisLine: {
            lineStyle: {
                color: '#B4B4B4',
            }
        },
        axisLabel: {
            formatter: '{value} ',
        }
    }],

    series: [
        {
            name: '交易量',
            type: 'line',
            stack: 'Total',
            data: [120, 132, 101, 134, 90, 230, 210],
            smooth: true,
            showAllSymbol: true,
            symbol: 'emptyCircle',
            symbolSize: 8,
            itemStyle: {
                color: '#409eff'
            },
        },
        {
            name: '交易额',
            data: [150, 232, 201, 154, 190, 330, 410],
            type: 'bar',
            barGap: '-100%',
            barWidth: 10,
            itemStyle: {
                borderRadius: 5,
                color: new echarts.graphic.LinearGradient(
                    0, 0, 0, 1,
                    [
                        { offset: 0, color: 'rgba(156,107,211,0.5)' },
                        { offset: 0.2, color: 'rgba(156,107,211,0.3)' },
                        { offset: 1, color: 'rgba(156,107,211,0)' }
                    ]
                )
            },
            z: -12,
        },
        {
            name: '成交量',
            data: [220, 182, 191, 234, 290, 330, 310],
            type: 'bar',
            barWidth: 10,
            itemStyle: {
                borderRadius: 5,
                color: new echarts.graphic.LinearGradient(
                    0, 0, 0, 1,
                    [
                        { offset: 0, color: '#956FD4' },
                        { offset: 1, color: '#3EACE5' }
                    ]
                )
            },
        },
        {
            name: '成交额',
            type: 'line',
            data: [320, 332, 301, 334, 390, 330, 320],
            smooth: true,
            showAllSymbol: true,
            symbol: 'emptyCircle',
            symbolSize: 8,
            itemStyle: {
                color: '#F02FC2'
            },

        }
    ]
};
export default option